module.exports = class extends think.Logic {
  postAction() {
    const rules = {
      username: {
        notIn: ['admin', 'root', 'system', 'sys', 'user', 'manager', 'teacher', 'student', 'school', 'guest', 'site'],
        string: true,
        required: true,
        length: { min: 3, max: 30 }
      },
      password: {
        string: true,
        required: true,
        length: { min: 6, max: 30 }
      }
    };
    const msgs = {
      username: '必须设置登陆用户名，最少3个字母',
      password: '必须设置登陆密码，最少6位字母或者数字组成'
    };
    const flag = this.validate(rules, msgs);
    if (!flag) {
      return this.fail(1001, 'validate error', this.validateErrors);
    }
  }
};
